/**
 * Created by Administrator on 14-2-10.
 */
var mongoose = require('mongoose');
var timestamps = require('mongoose-timestamp');//(给Model自动添加createdAt和updatedAt):

var Schema = mongoose.Schema,
    ObjectId = Schema.ObjectId;

// Schema 结构
var schema = new Schema({
    // _id:ObjectId, // default id
    tmpl_id:Number,     // 模板的id
    page_id:Number, //	页id
    page_index:Number, //	页index
    base_page_id:Number, //	来源页id
    rep_hash_tag:Number, // hash
    replaces:String,     // replaces
    backup_flg:Number,
    thumb:String

});
//Adding static methods to a Model
schema.statics.staticFunction = function(config, callback) {
    return this.find(config,function(error, items){
        console.log(items);
        callback(error, items);
    });
};
// built-in instance methods
schema.methods.instanceFunction = function(config, callback){
    this.model('MPageInfoModel').find(config,function(error, items){
        console.log(items);
        callback(error, items);
    });

};
schema.plugin(timestamps);
mongoose.model('MPageInfoModel', schema, 'MPageInfo');
